package com.nowc.week.w105_ak;

import java.io.*;
import java.util.Arrays;

public class e {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);
    static final long MOD = 998244353L;

    public static void main(String[] args) throws IOException {
        solve();
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        in.nextToken(); int m = (int) in.nval;
        long[] a = new long[n + 1];
        for (int i = 1; i < n + 1; i++) {
            in.nextToken(); a[i] = (int) in.nval;
        }
        int[] U = new int[m];
        int[] V = new int[m];
        int[] degree = new int[n+1];
        for (int i = 0; i < m; i++) {
            in.nextToken(); int u = (int) in.nval;
            in.nextToken(); int v = (int) in.nval;
            U[i] = u; V[i] = v;
            degree[u]++; degree[v]++;
        }

        long[] pow2 = new long[31];
        for (int k = 0; k <= 30; k++) pow2[k] = ((1L << k) % MOD);

        long ans = 0;
        int[] ones = new int[n+1];

        for (int k = 0; k <= 30; k++) {
            Arrays.fill(ones, 0);
            for (int i = 0; i < m; i++) {
                int u = U[i], v = V[i];
                if (((a[u] >> k) & 1L) == 1L) ones[v]++;
                if (((a[v] >> k) & 1L) == 1L) ones[u]++;
            }
            long cntBit = 0;
            for (int v = 1; v <= n; v++) {
                long one = ones[v];
                long zero = degree[v] - one;
                if (((a[v] >> k) & 1L) == 0L) {
                    cntBit += one * zero;
                } else {
                    cntBit += (one * (one - 1) / 2) + (zero * (zero - 1) / 2);
                }
            }
            cntBit %= MOD;
            ans = (ans + (cntBit * pow2[k]) % MOD) % MOD;
        }

        System.out.println(ans % MOD);

    }

}
